﻿using FPSO.Models.Domain;
using FPSO.Services.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FPSO.Services.Impl
{
    public class RealDataBindingServiceImpl<T> : IDataBindingService
    {
        private TSMapperBrige valueBrige;
   //     public RealDataBindingServiceImpl(string pdbConnStr, T viewModel)
   //     {
			////DEBUG SnapTSService用于从时序库中提取相应的数据，现在跳过这一步，仅使用ITSService
			////SnapTSService tsService = new SnapTSService();
			////tsService.ConnStr = pdbConnStr;
			//CommTSService commTSService = new CommTSService();
			//valueBrige = new TSMapperBrige(commTSService);
   //         valueBrige.InitDataContext(viewModel);
        //}
		public RealDataBindingServiceImpl(T viewModel)
		{
			//DEBUG SnapTSService用于从时序库中提取相应的数据，现在跳过这一步，仅使用ITSService
			//SnapTSService tsService = new SnapTSService();
			//tsService.ConnStr = pdbConnStr;
			CommTSService commTSService = new CommTSService();
			valueBrige = new TSMapperBrige(commTSService);
			valueBrige.InitDataContext(viewModel);
		}

		public void ReflushData(DateTime currentTime)
        {
			//valueBrige.UpdateValues();
			valueBrige.UpdateValues_tagList();
		}

		public void ReflushData(ManualCalcResult calcResult)
        {
            valueBrige.UpdateValues(calcResult);
        }
    }
}
